package io.kiki.sba.registry.store.jdbc.domain;

import io.kiki.sba.registry.store.api.meta.DbEntry;
import lombok.Setter;

import java.util.Date;


public class ClientManagerAddressDomain implements DbEntry {

    /**
     * primary key
     */
    @Setter
    private long id;

    /**
     * local data center
     */
    @Setter
    private String dataCenter;

    /**
     * local data center
     */
    @Setter
    private String address;

    /**
     * CLIENT_OFF/CLIENT_OPEN
     */
    private String operation;

    /**
     * create time
     */
    @Setter
    private Date gmtCreate;

    /**
     * last update time
     */
    private Date gmtModify;

    private long gmtCreateUnixNanos;

    /**
     * client_off pub true:持久化关流pub false:临时关流pub
     */
    private boolean pub;

    /**
     * client_off sub true:持久化关流sub false:临时关流sub
     */
    private boolean sub;

    public ClientManagerAddressDomain() {
    }

    public ClientManagerAddressDomain(String dataCenter, String address, String operation, boolean pub, boolean sub) {
        this.dataCenter = dataCenter;
        this.address = address;
        this.operation = operation;
        this.pub = pub;
        this.sub = sub;
    }


    public long getId() {
        return id;
    }


    public String getDataCenter() {
        return dataCenter;
    }


    public String getAddress() {
        return address;
    }


    public String getOperation() {
        return operation;
    }


    public void setOperation(String operation) {
        this.operation = operation;
    }


    public Date getGmtCreate() {
        return gmtCreate;
    }


    public Date getGmtModify() {
        return gmtModify;
    }


    public void setGmtModify(Date gmtModify) {
        this.gmtModify = gmtModify;
    }

    public boolean isPub() {
        return pub;
    }


    public void setPub(boolean pub) {
        this.pub = pub;
    }

    public boolean isSub() {
        return sub;
    }


    public void setSub(boolean sub) {
        this.sub = sub;
    }

    public long getGmtCreateUnixNanos() {
        return gmtCreateUnixNanos;
    }

    public void setGmtCreateUnixNanos(long gmtGmtCreateUnixNanos) {
        this.gmtCreateUnixNanos = gmtCreateUnixNanos;
    }

    public long getGmtCreateUnixMillis() {
        return gmtCreateUnixNanos / 1000000;
    }


}
